home *** CD-ROM | disk | FTP | other *** search
- { %filename% -- application-specific data management }
- { Created %date% %time% by AppMaker }
-
- { This module contains data structures to access the data in your }
- { document's file(s). The purpose is to isolate the details of the }
- { data representation into this module and to provide accessor }
- { functions for reading/writing logical pieces of the data. }
- { For your application, you will probably rewrite most of this. }
- { This module will not be regenerated by AppMaker unless you delete it. }
-
- Unit %appName%Data;
- Interface
-
- Uses
- %if lang = MPW%
- Types,
- Quickdraw,
- Controls,
- Events,
- Files,
- Lists,
- Menus,
- StandardFile,
- TextEdit,
-
- %end if%
- Globals,
- Miscellany;
-
- { Define the creator type and file type for your application.}
- const
- kSignature = 'XXXX';
- kFileType = 'TEXT';
-
- { Define any appropriate data structures for your application.}
- { Add any needed fields to Global's WinInfoRec so that each window}
- { can have its own set of data. Your functions will use "cur^"}
- { to access the data. Here, in the interface section, you should}
- { define only those types which are intended to be visible to}
- { modules outside this one. Later, in the implementation section,}
- { you can define additional "private" data structures.}
- type
- YourStuff = record
- data: integer;
- end;
-
- {----------}
- { Open, Close, Read, Write, Init, and Dispose are called by the}
- { AppMaker-generated FileM module to do application-specific file accessing.}
-
- Function OpenAppFile (vRefNum: integer;
- fName: Str255;
- var fRefNum: integer): boolean;
- Procedure CloseAppFile (fRefNum: integer);
- Procedure ReadAppFile (fRefNum: integer);
- Procedure WriteAppFile (fRefNum: integer);
- Procedure InitAppData;
- Procedure DisposeAppData;
-
- { These functions are for accessing your data as logical chunks.}
- { They are just models for your own accessor functions;}
- { they aren't called by any AppMaker-generated code.}
- { Replace them with whatever is suitable for your application.}
-
- Procedure AddStuff (stuff: YourStuff);
- Procedure DeleteStuff;
- Function GetStuff: boolean;
- Procedure PutStuff;
-
- {----------}
- Implementation
-
- %if lang = MPW%
- {$D+}
- {$R+}
- {$OV+}
- {$S %unitname%}
-
- %end if%
- { Define additional "private" data structures.}
- type
- MoreStuff = record
- data: integer;
- end;
-
- {----------}
- Procedure AddStuff (stuff: YourStuff);
- Begin
- with cur^ do begin
- end; {with}
- End; {AddStuff}
-
- {----------}
- Function GetStuff: boolean;
- Begin
- with cur^ do begin
- end; {with}
- GetStuff := false;
- End; {GetStuff}
-
- {----------}
- Procedure PutStuff;
- Begin
- with cur^ do begin
- end; {with}
- End; {PutStuff}
-
- {----------}
- Procedure DeleteStuff;
- Begin
- with cur^ do begin
- end; {with}
- End; {DeleteStuff}
-
- {----------}
- Procedure InitAppData;
- Begin
- with cur^ do begin
- end; {with}
- End; {InitAppData}
-
- {----------}
- Procedure DisposeAppData;
- Begin
- with cur^ do begin
- end; {with}
- End; {DisposeAppData}
-
- {----------}
- Function OpenAppFile (vRefNum: integer;
- fName: Str255;
- var fRefNum: integer): boolean;
- Begin
- OpenAppFile := CheckOS (FSOpen (fName, vRefNum, fRefNum));
- End; {OpenAppFile}
-
- {----------}
- Procedure CloseAppFile (fRefNum: integer);
- var
- okay: boolean;
- Begin
- if fRefNum <> 0 then begin {could be 0 if closing new document}
- okay := CheckOS (FSClose (fRefNum));
- end;
- End; {CloseAppFile}
-
- {----------}
- Procedure ReadAppFile (fRefNum: integer);
- Begin
- InitAppData;
- with cur^ do begin
- end; {with}
- End; {ReadAppFile}
-
- {----------}
- Procedure WriteAppFile (fRefNum: integer);
- Begin
- with cur^ do begin
- end; {with}
- End; {WriteAppFile}
-
- End. {%appName%Data}
-